package com.lagou.mr.homework;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class NumberReducer extends Reducer<NumberSort, NullWritable, NumberSort, NullWritable> {

    private int i = 1;
    @Override
    protected void reduce(NumberSort key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {

        for (NullWritable value : values) {
            key.setSort(i);
            context.write(key, value);
            i++;
        }
    }
}
